// 权限指令
import checkPer from '@/utils/permission'
import 'echarts-gl'
import Element from 'element-ui'
import 'highlight.js/styles/atom-one-dark.css'
import Cookies from 'js-cookie'
//
import mavonEditor from 'mavon-editor'
import 'mavon-editor/dist/css/index.css'
import 'normalize.css/normalize.css'
import Vue from 'vue'
// 代码高亮
import VueHighlightJS from 'vue-highlightjs'
import { getWeather } from './api/weather'
import App from './App'
import './assets/icons' // icon
import './assets/styles/element-variables.scss'
// global css
import './assets/styles/index.scss'
// 数据字典
import dict from './components/Dict'
// 数据字典V2 使用magic-api
import dictV2 from './components/DictV2'
import permission from './components/Permission'
import './router/index' // permission control
import router from './router/routers'
import store from './store'


import ECharts from 'vue-echarts/components/ECharts.vue'
Vue.component('v-chart', ECharts)

Vue.use(checkPer)
Vue.use(VueHighlightJS)
Vue.use(mavonEditor)
Vue.use(permission)
Vue.use(dict)
Vue.use(dictV2)
Vue.use(Element, {
  size: Cookies.get('size') || 'small' // set element-ui default size
})
Vue.config.productionTip = false

new Vue({
  el: '#app',
  router,
  store,
  data() {
    return {
      farm_id: null,
      weather: null,
      // weatherTimer: null
    }
  },
  watch: {
    farm_id() {
      // this.setWeather()
    }
  },
  mounted() {
    // this.weatherTimer = setInterval(this.setWeather, 10 * 60e3)
  },
  beforeDestroy() {
    // clearInterval(this.weatherTimer)
  },
  methods: {
    // async setWeather() {
    //   this.weather = await getWeather(this.farm_id)
    // }
  },
  render: h => h(App)
})
